{include file='common/head'}
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>信息流</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="{:url('index/xinxi/xinxi')}" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <xblock>
        <button class="layui-btn" onclick="x_admin_show('添加文章','{:url(\'index/xinxi/wenzhangadd\')}')"><i class="layui-icon"></i>添加文章</button>
        <button class="layui-btn" onclick="x_admin_show('添加产品','{:url(\'index/xinxi/add\')}')"><i class="layui-icon"></i>添加产品</button>
        <button class="layui-btn" onclick="x_admin_show('添加视频','{:url(\'index/xinxi/video\')}')"><i class="layui-icon"></i>添加视频</button>
    </xblock>
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
            <input type="text" name="title" value="{$Request.get.title|default=''}"  placeholder="请输入标题" autocomplete="off" class="layui-input">
            <input type="text" name="mid" value="{$Request.get.mid|default=''}"   placeholder="信息ID" autocomplete="off" class="layui-input">
            <div class="layui-input-inline">
                <select name="rflg">
                    <option value="">搜索信息状态</option>
                    <option {eq name="$Request.get.rflg" value="1"} selected{/eq} value="1">已认证</option>
                    <option {eq name="$Request.get.rflg" value="0"}  selected{/eq} value="0">未认证</option>
                </select>
            </div>
            <div class="layui-input-inline">
                <select name="uflg">
                    <option value="">搜索用户状态</option>
                    <option {eq name="$Request.get.uflg" value="1"} selected{/eq} value="1">正常</option>
                    <option {eq name="$Request.get.uflg" value="0"} selected{/eq} value="0">锁定</option>
                </select>
            </div>
            <input class="layui-input" placeholder="开始日" value="{$Request.get.datemin|default=''}" name="datemin" id="start">至
            <input class="layui-input" placeholder="截止日"  value="{$Request.get.datemax|default=''}" name="datemax" id="end">
            <input type="submit" name="sub" class="layui-btn" value="开始搜索" lay-submit="" lay-filter="sreach">
            <a title="查看" href="{:url('index/xinxi/daochuxinxi')}" >
                <span class="layui-btn">导出数据</span>
            </a>
        </form>
    </div>
    <table class="layui-table">
        <thead>
        <tr style="text-align: center">
            <th>NO</th>
            <th>信息ID</th>
            <th>类型</th>
            <th>群组</th>
            <th style="text-align: center">图片/视频</th>
            <th style="text-align: center">标题(前12字)</th><!--显示12个字-->
            <th>供应数量</th>
            <th>单位</th>
            <th style="text-align: center">价格</th>
            <th style="text-align: center">摘要(前20字)</th><!--前20个字-->
            <th>用户</th>
            <th>认证状态</th>
            <th style="text-align: center">发布时间</th>
           <!-- <th style="text-align: center">信息状态</th> -->
            <th style="text-align: center">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="rs" id="rs"}
        <tr style="text-align: center">
            <td>{$key+1}</td>
            <td>{$rs.mid}</td>
            <td>{if $rs.type==1}产品{else/}文章{/if}</td>
            <td>{$rs.group_name}</td>
            <td>
                {if $rs.type neq 3 }
                    {if $rs.picture==''}
                    <img src="/upload/message/no.jpg" width="130px;" height="100px;">
                    {else/}
                    <?php $str=$rs['picture'];
                            $a=explode(",",$str);?><img src="/upload/message/{$a['0']}" width="130px;" height="100px;">
                    {/if}
                {else}
                    <video src="{$rs.path}"  width="130px;" height="100px;" controls="controls" ></video>
                {/if}
             </td>
            <td>{$rs['title']|mb_substr=0,12,'utf-8'}</td>
            <td>{$rs.number}</td>
            <td>{if $rs.type==2}{elseif $rs.unit==1}吨{elseif $rs.unit==2}公斤{elseif $rs.unit==3}斤{else/}个{/if}</td>
            <td>{if $rs.type==2}{elseif $rs.unit==1}{$rs.price}元/吨{elseif $rs.unit==2}{$rs.price}元/公斤{elseif $rs.unit==3}{$rs.price}元/斤{else/}{$rs.price}元/个{/if}</td>
            <td>{$rs['content']|mb_substr=0,20,'utf-8'}</td>
            <td>{if $rs.uname==''}{:rawurldecode($rs.nickname)}{else/}{$rs.uname}{/if}</td>
            <td>{if $rs.rflg==1}已认证{else/}未认证{/if}</td>
            <td>{$rs.createtime}</td>
          <!--  <td><?php if($rs['stoptime']<date("Y-m-d H:i:s"))
                {
                    echo '过期';
                }
                else
                {
                    if($rs['mflg']=='0')
                    {
                        echo '锁定';
                    }
                    else
                    {
                         echo '正常';
                    }
                }?></td> -->
            <td class="td-manage">
                <a title="查看" href="javascript:;" attr_id='{$rs.mid}' onclick="banner_edit(this)">
                    <i class="layui-icon">&#xe63c;</i><span style="color: mediumblue">查看详情</span>
                </a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page">
        <div>
           {$page}
        </div>
    </div>

</div>
<script>
    function banner_edit(obj){
        var mid=$(obj).attr('attr_id');
        //alert(mid);
        var url="{:Url('xinxi/chakan')}?mid="+  mid;
        // alert(url);
        x_admin_show('查看',url);
    }
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

    /*用户-停用*/
    function member_stop(obj,id){
        layer.confirm('确认要停用吗？',function(index){

            if($(obj).attr('title')=='启用'){

                //发异步把用户状态进行更改
                $(obj).attr('title','停用')
                $(obj).find('i').html('&#xe62f;');

                $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                layer.msg('已停用!',{icon: 5,time:1000});

            }else{
                $(obj).attr('title','启用')
                $(obj).find('i').html('&#xe601;');

                $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
                layer.msg('已启用!',{icon: 5,time:1000});
            }

        });
    }

    /*用户-删除*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            //发异步删除数据
            $(obj).parents("tr").remove();
            layer.msg('已删除!',{icon:1,time:1000});
        });
    }



    function delAll (argument) {

        var data = tableCheck.getData();

        layer.confirm('确认要删除吗？'+data,function(index){
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
    }
</script>

</body>

</html>